﻿using System.Web.Http;
using System.Web.Http.Filters;
using System.Web.Http.Tracing;

namespace TfsStatus.Infrastructure
{
	public class NLogExceptionFilterAttribute : ExceptionFilterAttribute
	{
		public override void OnException(HttpActionExecutedContext actionExecutedContext)
		{
			base.OnException(actionExecutedContext);
			actionExecutedContext.ActionContext.ControllerContext.Configuration.Services.GetTraceWriter().Error(
				actionExecutedContext.Request, "Exception", actionExecutedContext.Exception, "Exception message: " + actionExecutedContext.Exception);
		}
	}
}